<template>
  <div class="floorBanner">
    <!-- 轮播图 -->
    <div class="swiper-container" id="floor1Swiper">
      <div class="swiper-wrapper">
        <div
          class="swiper-slide"
          v-for="(item, index) in bannerDate"
        >
          <img :src="item.imgUrl" />
        </div>
      </div>
      <!-- 如果需要分页器 -->
       <div class="swiper-pagination"></div>

      <!-- 如果需要导航按钮 -->
      <div class="swiper-button-prev"></div>
      <div class="swiper-button-next"></div>
    </div>
  </div>
</template>
<script>
import Swiper from "swiper";
export default {
  name: "Curousel",
  components: {},
  props: {
    bannerDate: {
      type: Array,
      default: () => [],
    },
  },
  watch: {
    bannerDate: {
      handler() {
        this.$nextTick(() => {
          new Swiper(".swiper-container", {
            autoplay: true, //是否自动播放  默认是false
            delay: 1, //设置时间。间隔几秒切换一次
            // direction: 'vertical', 垂直切换选项(默认是水平方向)
            loop: true, // 循环模式选项

            pagination: {
              el: ".swiper-pagination",
            },

            // 如果需要前进后退按钮
            navigation: {
              nextEl: ".swiper-button-next",
              prevEl: ".swiper-button-prev",
            },
          });
        });
      },
      immediate: true, //初始化的时候，立即执行
    }
  },
};
</script>
<style scoped lang='less'>

</style>